// ==UserScript==
// @name         AList Tools
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://lenovo-g460e.localhost.cn:5678/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=localhost.cn
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  
  // Your code here...
  var origin = document.location.origin
  console.log("Alist Tools已启动！", `origin: ${origin}`)
  
  function getHrefs () {
    var elementList = document.getElementsByClassName('list-item');
  
    if(elementList && elementList.length > 0) {
      console.log(elementList)
      var hrefList = Array.from(elementList).map(item => {
        return item.href.replace(origin, origin+'/d');
      })
    
      console.log(hrefList.join("\n"));
    } else {
      setTimeout(()=>{
        getHrefs()
      }, 2000)
    }
  }
  
  getHrefs()
  
})();
